Skip to content

🐛 fix[gitlab]: add assignee sync diagnostics#115356

Merged
GabeVillalobos merged 1 commit into
masterfrom
raj--gitlab--assignee-sync-lifecycle
Jun 1, 2026
Merged

🐛 fix[gitlab]: add assignee sync diagnostics#115356
GabeVillalobos merged 1 commit into
masterfrom
raj--gitlab--assignee-sync-lifecycle

Conversation

@iamrajjoshi
Copy link
Copy Markdown
Collaborator

@iamrajjoshi iamrajjoshi commented May 12, 2026

Description of the change

I am not fully certain we have the root cause of the GitLab assignment sync failures yet. Based on review and hand testing, this no longer changes assignee matching to prefer mapped external IDs or stricter username matching; it keeps the existing GitLab username search behavior.

This adds lifecycle context around inbound and outbound assignment sync so the next failure has enough detail to diagnose the mapping/search path. It preserves the existing no-op return behavior for GitLab outbound cases that previously returned early, including missing mapped external actors, invalid issue keys, GitLab user search failures, and empty GitLab user search results.

Test plan

  • Python compile check for touched files
  • Ruff check and format hooks for touched files
  • Targeted mypy hook for touched source files
  • Targeted pytest attempted locally, but Postgres/Redis devservices were not running in this worktree

Considerations

This is intentionally diagnostic: it preserves the current GitLab username resolution path while adding enough context to confirm or disprove the current assignment-sync hypothesis.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 12, 2026
@iamrajjoshi iamrajjoshi force-pushed the raj--gitlab--assignee-sync-lifecycle branch from dd53ec7 to d3b924f Compare May 12, 2026 04:04
@iamrajjoshi iamrajjoshi self-assigned this May 12, 2026
Comment on lines +126 to +130
if external_actor.external_id:
try:
gitlab_user_id = int(external_actor.external_id)
except ValueError:
logger.warning("assignee-outbound.invalid-external-id", extra=log_context)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case will never execute. We don't set external ID for any of our GitLab mappings, so I'm not sure if this changes anything.


# Search for the GitLab user by username to get their user ID
try:
users = client.search_users(gitlab_username) or []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hand tested this API with my GitLab user, and this request should have returned a single user, so I can vouch that this is correct at least. Also, this API only returns a single username when a username is passed as query param, so the previous logic was slightly more correct: https://docs.gitlab.com/api/users/#as-a-regular-user

@iamrajjoshi iamrajjoshi force-pushed the raj--gitlab--assignee-sync-lifecycle branch from d3b924f to 82a466e Compare May 18, 2026 15:03
@iamrajjoshi iamrajjoshi changed the title 🐛 fix[gitlab]: sync assignees by external id 🐛 fix[gitlab]: add assignee sync diagnostics May 18, 2026
@iamrajjoshi iamrajjoshi force-pushed the raj--gitlab--assignee-sync-lifecycle branch from 82a466e to 0e3ed16 Compare May 18, 2026 15:07
@iamrajjoshi iamrajjoshi force-pushed the raj--gitlab--assignee-sync-lifecycle branch from 0e3ed16 to ef898a1 Compare May 18, 2026 15:09
@iamrajjoshi iamrajjoshi marked this pull request as ready for review May 30, 2026 21:41
@iamrajjoshi iamrajjoshi requested a review from a team as a code owner May 30, 2026 21:41
@iamrajjoshi iamrajjoshi force-pushed the raj--gitlab--assignee-sync-lifecycle branch from ef898a1 to 8b0e4f7 Compare May 30, 2026 21:41
@iamrajjoshi iamrajjoshi force-pushed the raj--gitlab--assignee-sync-lifecycle branch from 8b0e4f7 to bbe16d8 Compare May 31, 2026 18:44
@GabeVillalobos GabeVillalobos merged commit 9d3420d into master Jun 1, 2026
66 checks passed
@GabeVillalobos GabeVillalobos deleted the raj--gitlab--assignee-sync-lifecycle branch June 1, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants